package EP::Visualization::Hooks;
use strict;

sub new {
  my $proto = shift;
  my $class = ref($proto) || $proto;
  my $self = {};
  bless $self, $class;

  $self->setHookSet ( @_ ) if @_;
  return $self;
}

sub setHookSet {
  my $self = shift;
  my ($hooks, $annot ) = @_;

  my %hooked_annot;
  $hooked_annot{$_} = $annot->{$_} foreach @$hooks;

  die "No hook data supplied to Hooks::setHookSet" if not $hooks;
  $self->{HookSet} = $hooks;
  $self->{Annot}   = \%hooked_annot;
}

sub getHookSet {
  my $self=shift;
  return $self->{HookSet};
}

sub getAnnot {
  my $self = shift;
  return $self->{Annot};
}

sub match_hooks {
  my $self = shift;
  my $hookSetToMatch = shift;

  my $h1 = $self->getHookSet();
  my $h2 = $hookSetToMatch->getHookSet();

  foreach my $hook ( @$h1 ) {
    return 0 if 0 == grep { $_ == $hook } @$h2;
  }
}

1;
